home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / metamail / contrib / sh-versions / audiosend < prev    next >
Encoding:
Text File  |  1993-05-18  |  3.0 KB  |  117 lines

  1. :
  2. # Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
  3. # Permission to use, copy, modify, and distribute this material 
  4. # for any purpose and without fee is hereby granted, provided 
  5. # that the above copyright notice and this permission notice 
  6. # appear in all copies, and that the name of Bellcore not be 
  7. # used in advertising or publicity pertaining to this 
  8. # material without the specific, prior written permission 
  9. # of an authorized representative of Bellcore.  BELLCORE 
  10. # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
  11. # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
  12. # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  13.  
  14. # Conversion from C shell to Bourne shell by Z-Code Software Corp.
  15. # Conversion Copyright (c) 1992 Z-Code Software Corp.
  16. # Permission to use, copy, modify, and distribute this material
  17. # for any purpose and without fee is hereby granted, provided
  18. # that the above copyright notice and this permission notice
  19. # appear in all copies, and that the name of Z-Code Software not
  20. # be used in advertising or publicity pertaining to this
  21. # material without the specific, prior written permission
  22. # of an authorized representative of Z-Code.  Z-CODE SOFTWARE
  23. # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
  24. # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
  25. # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  26.  
  27. # This is to make metamail/showaudio do playback on the speaker, not the phone.
  28. AUDIOSPEAKERFORCE=1 ; export AUDIOSPEAKERFORCE
  29.  
  30. if test -d /usr/sony
  31. then
  32.     dev=/dev/sb0
  33. else
  34.     dev=/dev/audio
  35. fi
  36.  
  37. if test -f /usr/lib/sendmail
  38. then
  39.     MAILCOMMAND=/usr/lib/sendmail
  40. else
  41.     MAILCOMMAND=/bin/mail
  42. fi
  43.  
  44. echo-n "To: "
  45. read to
  46. echo-n "Subject: "
  47. read subject
  48. echo-n "CC: "
  49. read cc
  50.  
  51. record=1
  52.  
  53. while true
  54. do
  55.     if test $record -eq 1
  56.     then
  57.         echo-n "Press RETURN when you are ready to start recording: "
  58.         read foo
  59.  
  60.         fname=/tmp/audio-out.$$
  61.         fnameraw=/tmp/audio-raw.$$
  62.  
  63.         echo "To: $to" > $fname
  64.         echo "Subject: $subject" >> $fname
  65.         echo "CC: $cc" >> $fname
  66.         echo "MIME-Version: 1.0" >> $fname
  67.         echo "Content-Type: audio/basic" >> $fname
  68.         echo "Content-Transfer-Encoding: base64" >> $fname
  69.         echo "" >> $fname
  70.  
  71.         trap "kill -9 $! > /dev/null 2>&1" 1 2 15
  72.  
  73.         if test -z "RECORD_AUDIO"
  74.         then
  75.             (/bin/cat < $dev > $audiofile) &
  76.         else
  77.             ($RECORD_AUDIO > $audiofile) &
  78.         fi
  79.         echo-n "press RETURN when you are done recording: "
  80.         read foo
  81.         echo One moment please...
  82.         /bin/sleep 1
  83.         echo-n Killing recording job...
  84.         /bin/kill -9 $! > /dev/null 2>&1
  85.         mmencode -b < $fnameraw >> $fname
  86.         /bin/rm $fnameraw
  87.         echo "" >> $fname
  88.     fi
  89.     record=0
  90.  
  91.     echo ""
  92.     echo "What do you want to do?"
  93.     echo ""
  94.     echo "1 -- Send mail"
  95.     echo "2 -- Listen to recorded message"
  96.     echo "3 -- Replace with a new recording"
  97.     echo "4 -- Quit"
  98.     read which
  99.     case $which in
  100.         1) echo-n "Sending mail, please wait...  "
  101.           $MAILCOMMAND $to $cc < $fname
  102.  
  103.           if test $? -eq 0
  104.           then
  105.             echo Done.
  106.             /bin/rm -f $fname
  107.             exit 0
  108.           else
  109.             echo Mail delivery failed, draft is in $fname
  110.           fi ;;
  111.         2) metamail -d $fname ;;
  112.         3) record=1 ;;
  113.         4) exit 0 ;;
  114.     esac
  115. done
  116.